package com.example.httpclient.handler;


import lombok.extern.slf4j.Slf4j;
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.io.HttpClientResponseHandler;

@Slf4j
public class CustomHttpClientResponseHandler implements HttpClientResponseHandler<ClassicHttpResponse> {
    @Override
    public ClassicHttpResponse handleResponse(ClassicHttpResponse response) {

        try {
            byte[] content = response.getEntity().getContent().readAllBytes();
            log.info("\n{}", new String(content));
        } catch (Exception e) {
            log.error("", e);
        }
        return response;
    }
}